package dcc.service;

import dcc.model.HainanChineseInfo;
import dcc.persistence.HainanChineseMapper;

public class HainanChineseService extends BaseService {

	private HainanChineseMapper hainanChineseMapper;

	public HainanChineseService() {
		super(HainanChineseService.class);
	}

	public void setHainanChineseMapper(HainanChineseMapper hainanChineseMapper) {
		this.hainanChineseMapper = hainanChineseMapper;
	}

	public void save(HainanChineseInfo hainanChineseInfo) {
		if (hainanChineseInfo.getId() == 0) {
			insert(hainanChineseInfo);
		} else {
			update(hainanChineseInfo);
		}
	}

	private void insert(HainanChineseInfo hainanChineseInfo) {
		hainanChineseMapper.insert(hainanChineseInfo);
	}

	private void update(HainanChineseInfo hainanChineseInfo) {
		hainanChineseMapper.update(hainanChineseInfo);
	}

	public HainanChineseInfo getHainanChineseInfoByBaseId(int baseId) {
		return hainanChineseMapper.getHainanChineseInfoByBaseId(baseId);
	}
}
